home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / bin / showpicture < prev    next >
Encoding:
Text File  |  1993-05-24  |  2.4 KB  |  85 lines

  1. #!/bin/csh -f
  2. # Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
  3. # Permission to use, copy, modify, and distribute this material 
  4. # for any purpose and without fee is hereby granted, provided 
  5. # that the above copyright notice and this permission notice 
  6. # appear in all copies, and that the name of Bellcore not be 
  7. # used in advertising or publicity pertaining to this 
  8. # material without the specific, prior written permission 
  9. # of an authorized representative of Bellcore.  BELLCORE 
  10. # MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
  11. # OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
  12. # WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  13. #
  14.  
  15. if (! $?METAMAIL_TMPDIR) then
  16.     set METAMAIL_TMPDIR=/tmp
  17. endif
  18.  
  19. if (! $?X_VIEWER) then
  20. set X_VIEWER="xloadimage -view -quiet -geometry +1+1"
  21. # set X_VIEWER="xv -geometry +1+1"
  22. endif
  23. if ($1 == "-viewer" && $#argv > 1) then
  24.     set X_VIEWER = "$2"
  25.     shift
  26.     shift
  27. endif
  28.  
  29. if (! $?DISPLAY) then
  30.     echo ""
  31.     echo This message contains a picture, which can currently only be
  32.     echo viewed when running X11.  If you read this message while running
  33.     echo X11, and have your DISPLAY variable set, you will then
  34.     echo be able to see the picture properly.
  35.     echo ""
  36.     if ($?MM_NOTTTY) then
  37.         set fname=${METAMAIL_TMPDIR}/sp.$$
  38.         echo "The picture is being automatically stored in the file $fname"
  39.         echo "If you do not want this file, please delete it."
  40.     else
  41.         echo -n "Do you want to write the picture out to a file [y] ? "
  42.         set ANS=$<
  43.         if ("$ANS" =~ n* ||  "$ANS" =~ N* ) exit 0
  44.         echo -n "File name:"
  45.         set fname=$<
  46.     endif
  47.     cp $1 $fname
  48.     if ($status == 0) echo Wrote file $fname
  49.     exit 0
  50. endif
  51.  
  52. if ($#argv == 0) then
  53.     set SQUIRREL=${METAMAIL_TMPDIR}/sp.$$
  54.     cat > $SQUIRREL
  55. else
  56.     set SQUIRREL="$*"
  57. endif
  58.  
  59. echo NOTE:  TO MAKE THE PICTURE WINDOW GO AWAY, JUST TYPE 'q' IN IT.
  60. if ($#argv == 0) then
  61.     echo "==> TO SAVE THIS IMAGE, COPY THE FILE $SQUIRREL BEFORE EXITING"
  62.     echo ""
  63.     $X_VIEWER $SQUIRREL
  64.     rm $SQUIRREL
  65. else
  66.  
  67. foreach i ($*)
  68.     echo "==> TO SAVE THIS IMAGE, COPY THE FILE $i BEFORE EXITING"
  69.     echo ""
  70.     set dir=$i:h
  71.     if ($dir != $i) then
  72.     # Make the ln sure to work    
  73.     cd $dir
  74.     endif
  75.     ln $i $$.PRESS-q-TO-EXIT 
  76.     if (! $status) then 
  77.         sh -c "$X_VIEWER $$.PRESS-q-TO-EXIT"
  78.         rm $$.PRESS-q-TO-EXIT 
  79.     else
  80.         sh -c "$X_VIEWER $i"
  81.     endif
  82. end
  83. endif
  84.